import { post } from '../../utils/axios.ts'

/**
 * 接口定义
 */
// 登录表单接口
export interface LoginForm
{
	account: string
	password: string
}

// 忘记密码表单接口
export interface ForgotPasswordForm
{
	email: string
	verificationCode: string
	newPassword: string
	confirmPassword: string
}


/**
 * 登录
 * @param data 登录表单
 * @returns Promise<string> - 返回token
 */
export const login = (data: LoginForm): Promise<string> => {
  return post<string>('/user/login', data)
}


/**
 * 发送验证码到指定邮箱
 * @param email - 接收验证码的邮箱地址
 * @returns Promise<boolean> - 返回发送成功状态
 */
export const sendVerificationCode = (email: string): Promise<boolean> => {
  return post<boolean>('/user/email-code', {email})
}
